<script setup lang='ts'>
import { ref } from 'vue';

const imgUrl = ref('https://img0.baidu.com/it/u=3548423924,1128945813&fm=253&fmt=auto&app=138&f=JPEG?w=505&h=500')
const msg = ref('百度一下')
const isActive = ref(true)
</script>

<template>
    <img v-bind:src="imgUrl" v-bind:title="msg" alt="">
    <img :src="imgUrl" :title="msg" alt="">
    <button class="btn" :class="{ red: isActive }" @click="isActive = !isActive">
        点击切换
    </button>
</template>

<style scoped></style>